<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>应收发票管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">

		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function(form){
					jp.loading();
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
	        $('#invoiceDate').datetimepicker({
				 format: "YYYY-MM-DD HH:mm:ss"
		    });
            //当结算日期为空时，赋值当前时间
            if($("#dd").val()==""){
                document.getElementById("dd").value = getNowFormatDate();
            }
            //初始状态默认为已输入
            if($("#status").val()==""){
                $("#status").val(0);
            }
            //获取应付结算单的结算方赋值给发票主表的结算方
            if($("#payee").val()){
                $("#invoiceObj").val($("#payee").val());
            }
		});
        <%--给日期赋初始值--%>
        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            var minute = date.getMinutes();
            if (minute >= 0 && minute <= 9) {
                minute = "0" + minute;
            }
            var seconds = date.getSeconds();
            if (seconds >= 0 && seconds <= 9) {
                seconds = "0" + seconds;
            }
            var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                + " " + date.getHours() + seperator2 + minute + seperator2 + seconds;
            return currentdate;
        }
        function model(){
            all_ajax();
		}
        //弹出框提取数据ajax
        function all_ajax(){
            var balance = $("#balance").val().trim();
            $.ajax({
                url : "${ctx}/fee/payInvoice/findAllPayableList",
                data:{"status":0 , "clearUnit": balance},
                success: function(data) {
                    $("#payableLists").empty();
                    //var list = eval(data);
                    $.each(data,function(index,item) {
                        var addTr = $("<tr id='"+item.id+"'></tr>");
                        addTr.appendTo("#payableLists");
                        var td = ("<td>"+"<input id='"+item.id+"' value='"+item.id+"' type='checkbox' class='i-checks'>"+"</td>");
                        addTr.append(td);
                        if(item.status==1){
                            addTr.append($("<td id='status_"+item.id+"'>"+"</td>").text("已确认"));
                        }else if(item.status==2){
                            addTr.append($("<td id='status_"+item.id+"'>"+"</td>").text("部分开票"));
						}else if(item.status==4){
                            addTr.append($("<td id='status_"+item.id+"'>"+"</td>").text("部分核销"));
                        }else{
                            addTr.append($("<td id='status_"+item.id+"'>"+"</td>").text("全部核销"));
						}
                        addTr.append($('<td></td>').text(item.clearingNo));
                        addTr.append($('<td></td>').text(item.busyDate));
                        addTr.append($("<td id='payer_"+item.id+"'>"+"</td>").text(item.payee.name));
                        addTr.append($('<td></td>').text(item.clearingMoney));
                        addTr.append($('<td></td>').text(item.remarks));
                    })
                },
                error : function(data){
                    alert("操作失败!");
                }
            });
        }
        //获得所有选中的复选框的id
        function getCheckBox(){
            var boxs = "";		//设置变量，用于接收选中的复选框
            $("input:checkbox").each(function() {
                //判断复选框是否被选中
                if ($(this).is(':checked') && $(this).attr("id") != "allCheckBox") {
                    boxs += $(this).val();
                    boxs += ",";	//复选框的val()id集合以逗号分割
                }
            });
            return boxs;
        }
        //获取弹出框上查询按钮
        function searchDetail() {
            //加载层-默认风格
            layer.load();
            //此处演示关闭
            setTimeout(function(){
                layer.closeAll('loading');
            },500);
            all_ajax();
        }
        //获取弹出框上重置按钮
        function reset(){//重置，页码清零
            $("#pageno").val(0);
            $("#searchform div.form-group input").val("");
            $("#searchform div.form-group select").val("");
            //加载层-默认风格
            layer.load();
            //此处演示关闭
            settimeout(function(){
                layer.closeall('loading');
            },500);
            all_ajax();
            return false;

        }
        <%--  模态框的确定按钮 --%>
        function detailSure(){
            var tempIds = getCheckBox();
            var tempStr = tempIds.split(",");
            var ids = "";	//获取选中复选框的id
            var sc = "1";	//机构名称变量
            var textName = "";
            if(tempIds == null || tempIds == ""){
                alert("请至少选择一条数据");
                return;
            }
            for(var i=0;i<tempStr.length;i++){
                if(!tempStr[i]) continue;
                var tempSc = $("#payer_"+tempStr[i]).text().trim();
                if(sc=="1"){
                    sc = tempSc;	//第一个元素赋值到sc
                }else if(sc != tempSc){//上一个元素sc与本次循环的值不相等，不是同一个机构
                    layer.alert("请选择相同的结算方!");
                    return;
                }
                if($("#status_"+tempStr[i]).text()){
                    var text = $("#status_"+tempStr[i]).text().trim();
                    if(text == "已确认" || text == "部分开票" || text == "部分核销" || text == "全部核销"){
                        //状态为已确认和部分开票才能进行开票操作
                        textName = !textName ? text : textName;
                        if(text == textName){
                            ids += tempStr[i]+",";
                        }else{
                            alert("请选择相同状态的结算单!");
                            return;
                        }
                    }
                }else return ;
            }
            $('#myModal').modal('hide');
            $(".modal-backdrop").removeClass('in');
            layer.load();
            $.ajax({
                url : "${ctx}/fee/payable/addInvoice",
                data : {		 //参数值
                    "ids" :ids
                },
                type:"post",
                success : function(data) {
                    if(data){
                        var invoiceObj = "";
                        var list = eval(data);
                        //开票金额
                        var invMoney = $("#money").val()*1;
                        var ids =$("#ids");
                        $.each(list,function(index,term){
                            var addTr = $("<tr id='"+term.id+"'></tr>");
                            addTr.appendTo("#detailTbody");
                            var td = ("<td>"+"<input id='"+term.id+"'  type='checkbox' class='i-checks'>"+"</td>");
                            addTr.append(td);
                            addTr.append($('<td></td>').text(term.clearingNo));
                            addTr.append($("<td id='"+term.id+"_clearingMoney'>"+"</td>").text(term.clearingMoney));
                            addTr.append($("<td id='"+term.id+"_voiceMoney'>"+"</td>").text(term.invoiceMoney));
                            addTr.append("<td  class='coun' name='"+term.id+"'>"+"<input type='text' id='"+term.id+"_invMoney' onchange=\"inputBlur()\"  class='form-control required' value=''/>"+"</td>");
                            addTr.append($('<td></td>').text(term.remarks));
                            addTr.append("<td><a href='#' onclick=\"jp.openDialogView('查看结算单明细', '${ctx}/fee/payable/form?different=1&id="+term.id+"','800px', '500px')\" class='btn btn-info btn-xs' ><i class='fa fa-search-plus'></i> 查看</a>"
                                +"&nbsp;<input onclick=\"deleteInPage('"+term.id+"')\"  type='button' value='删除' class='btn btn-danger btn-xs'>"+"</td>");
                            //开票金额等于本次开票金额累加
                            invMoney += $("#"+term.id+"_invMoney").val();
                            var tempId = ids.val();
                            tempId += term.id;
                            tempId += ",";
                            ids.val(tempId);
                            //获取结算方
                            invoiceObj = term.payee.name;
                            $.ajax({
                                url: "${ctx}/fee/payInvoice/findInvoicePropertyByName",
                                data: {
                                    name: "name",//属性名
                                    propertyValue: invoiceObj//属性值
                                },
                                success: function (data) {
                                    console.log(data);
                                    if (data) {
                                        $("#taxPayerNo").val(data.taxPayerNo);
                                        $("#bankName").val(data.bankName);
                                        $("#bankNo").val(data.bankNo);
                                        $("#tel").val(data.phone);
                                        $("#bankAddress").val(data.bankAddress);
                                    }
                                }
                            });
                        })
                        //开票金额置为invMoney
                        $("#money").val(invMoney);
                        //设置发票主表的结算方
                        $("#invoiceObj").val(invoiceObj);
                        layer.closeAll('loading');
                    }else{
                        //开票金额置为0
                        $("#money").val(invMoney);
                        layer.closeAll('loading');
                    }
                },
                error : function(data){
                    alert("操作失败!");
                    layer.closeAll('loading');
                }
            });
		}
        //获取本次开票金额和应付账款id
        function inputBlur(){
            var countMoney = 0 *1;
            var tempId = "";
            $("#contentTable tr:gt(0)").each(function(i){
                $(this).children("td").each(function(j){
                    if($(this).attr("class") == "coun"){
                        var inputId = $(this).attr("name")+"_invMoney";
                        var tempMoney = $("#"+inputId).val();
                        if(isNaN(tempMoney)){
                            alert("请输入数字");
                            $("#"+inputId).val(null);
                            return;
                        }
                        if(tempMoney >= 0){
                            //获得结算金额
                            var clearObj = $(this).attr("name")+"_clearingMoney";
                            var cleanMoney = $("#"+clearObj).text() * 1;
                            //获得已开票金额
                            var voiceObj = $(this).attr("name")+"_voiceMoney";
                            var voiceMoney = $("#"+voiceObj).text() * 1;
                            //alert("结算金额："+cleanMoney+"，已开票金额"+voiceMoney+"，剩余金额"+(cleanMoney-voiceMoney));
                            //比较      已开票金额+本次开票金额    是否大于  结算金额【如果大于，返回；如果小于，继续执行】
                            if((cleanMoney-voiceMoney) < tempMoney){
                                alert("本次开票金额不得大于结算金额!");
                                $("#"+inputId).val(null);
                                return;
                            }
                            countMoney += tempMoney * 1;
                            tempId += $(this).attr("name")+"_"+tempMoney;
                            tempId += ",";
                        }else{
                            alert("开票金额不能小于零");
                            $("#"+inputId).val(null);
                            return;
                        }
                    }
                });
            });
            $("#money").val(countMoney);
            var values = $("#ids").val();
            values = tempId;
            $("#ids").val(values);
        }
        //不走后台，删除已经引入的明细
        function deleteInPage(id) {
            if (confirm("确定要删除吗？")) {
                //获取原来的开票金额
                var invoiceMoney = $("#money").val() * 1;
                //获取本次开票金额
                var theInvoiceMoney = $("#" + id + "_invMoney").val() * 1;
                $("#money").val(invoiceMoney - theInvoiceMoney);
                $("#detailTbody tr").each(function () {
                    var trId = $(this).attr("id");
                    if (trId == id) {
                        //获得页面原来的ids
                        var str = $("#ids").val();
                        var _str = str.trim().split(",");
                        str = "";
                        for (var i = 0; i < _str.length; i++) {
                            if(!(_str[i].indexOf(id) < 0) ) {
                                //ids删除id,ids中原来包含的id置为空字符串
                                _str[i] = "";
                            }
                            //重新追加ids的值
                            str += _str[i] + ",";
                        }
                        //ids重新赋值
                        $("#ids").val(str);
                        //tbody删除id= 传入id的一行数据
                        $(this).remove();
                    }
                })
            }
        }
        //已输入状态下删除一条明细记录【从应收发票明细表中删除】
        function deletes(id){
            if (confirm("确定要删除吗？")) {
                window.location.href = "${ctx}/fee/payInvoice/removePayInvoiceDetail?id=" + id;
            }
        }
        //点击确认按钮将已输入状态修改为已确认状态
        function verify(id){
           /* $.ajax({
                url : "${ctx}/fee/payInvoice/updateStatus",
                data : {		 //参数值
                    "ids" :id
                },
                type:"post",
                success : function(data) {
                    location.reload();
                },
                error : function(data){
                    alert("操作失败!");
                }
            });*/
            window.location.href="${ctx}/fee/payInvoice/updateStatusTwo?id="+id;
        }
        //核销操作
        function fukuan(id){
            <%--var url = "${ctx}/fee/payInvoice/verificOperation?ids="+id+"&type=1";--%>
            <%--var a=document.body.offsetHeight-100+'px'--%>
            <%--jp.openDialog("新增"+'付款单',url,"${width==null?'800px':width}", "${height==null?'"+a+"':height}");--%>
            window.location.href="${ctx}/fee/payInvoice/verificOperation?ids="+id+"&type=1";
        }
        //获取货主项目的发票信息
        $(document).ready(function() {
            $.ajax({
                url: "${ctx}/fee/payInvoice/findInvoicePropertyByName",
                data: {
                    name: "name",//属性名
                    propertyValue: $("#invoiceObj").val()//属性值
                },
                success: function (data) {
                    console.log(data);
                    if (data) {
                        $("#taxPayerNo").val(data.taxPayerNo);
                        $("#bankName").val(data.bankName);
                        $("#bankNo").val(data.bankNo);
                        $("#tel").val(data.phone);
                        $("#bankAddress").val(data.bankAddress);
                    }
                }
            });
        });
	</script>
</head>
<body>
<div class="wrapper wrapper-content">				
<div class="row">
	<div class="col-md-12">
	<div class="panel panel-primary">
	<c:if test="${target eq 'payableList'}">
		<div class="panel-heading">
			<h3 class="panel-title">
				<a class="panelButton" href="${ctx}/fee/payable"><i class="ti-angle-left"></i> 返回</a>
			</h3>
		</div>
	</c:if>
	<c:if test="${type ne 1}">
		<c:if test="${different ne 'paymentPage'}">
			<div class="panel-heading">
				<h3 class="panel-title">
					<a class="panelButton" href="${ctx}/fee/payInvoice"><i class="ti-angle-left"></i> 返回</a>
				</h3>
			</div>
		</c:if>
		<br>
		<c:if test="${(payInvoice.id ne null and payInvoice.status eq 0) or payInvoice.id eq null}">
			<button class="btn btn-primary btn-sm fl" data-toggle="modal" data-target="#myModal" onclick="model()">引入结算单</button>
		</c:if>
		<c:if test="${payInvoice.id ne null and payInvoice.status eq 0}">
			<a href="#" onclick="verify('${payInvoice.id}')"  class="btn btn-success btn-sm"> 确认</a>
		</c:if>
		<c:if test="${payInvoice.id ne null and (payInvoice.status eq 1 or payInvoice.status eq 2)}">
			<!--判断付款单子表的查看[如果触发的是发票子表的查看按钮，则不显示这些信息]-->
			<c:if test="${different ne 'paymentPage'}">
				<a href="#" onclick="fukuan('${payInvoice.id}')"  class="btn btn-success btn-sm margin-left"> 付款</a>
			</c:if>
		</c:if>
	</c:if>
		<div class="panel-body">
		<form:form id="inputForm" modelAttribute="payInvoice" action="${ctx}/fee/payInvoice/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
			<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
				<tbody>
				<tr>
					<c:if test="${payInvoice.id ne null}">
						<td class="width-12 active"><label class="pull-right"><font color="red">*</font>开票单号：</label></td>
						<td class="width-21" >
							<form:input path="invoiceNo" htmlEscape="false"    class="form-control required"/>
						</td>
					</c:if>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>开票日期：</label></td>
					<td class="width-21" >
						<div class='input-group form_datetime' id='invoiceDate'>
							<input type='text'  name="invoiceDate" id="dd" class="form-control"  value="<fmt:formatDate value="${payInvoice.invoiceDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>
					</td>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>状态：</label></td>
					<td class="width-21" >
						<form:select path="status"  id="status" class="form-control required">
							<form:option value="" label=""/>
							<form:options items="${fns:getDictList('pay_invoice_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>
				</tr>
				<tr>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>结算方：</label></td>
					<td class="width-21" >
						<form:input path="invoiceObj" htmlEscape="false"  id="invoiceObj"  class="form-control required"/>
					</td>
					<td class="width-12 active"><label class="pull-right">核销金额：</label></td>
					<td class="width-21" >
						<form:input path="vcaMoney" htmlEscape="false"    class="form-control  isFloatGteZero"/>
					</td>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>实体票号：</label></td>
					<td class="width-21" >
						<form:input path="entityNo" htmlEscape="false"  id="entityNo"  class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="width-12 active"><label class="pull-right">开票金额：</label></td>
					<td class="width-21" >
						<form:input path="invoiceMoney" htmlEscape="false" id="money"   class="form-control number"/>
					</td>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>发票类型：</label></td>
					<td class="width-21" >
						<form:radiobuttons path="invoiceType" items="${fns:getDictList('invoice_type')}" itemLabel="label" itemValue="value" htmlEscape="false" class="i-checks required"/>
					</td>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>纳税人识别号：</label></td>
					<td class="width-21" >
						<form:input path="taxPayerNo" htmlEscape="false"  id="taxPayerNo"  class="form-control required"/>
					</td>
				</tr>
				<tr>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>开户行：</label></td>
					<td class="width-21" >
						<form:input path="bankName" htmlEscape="false"  id="bankName"  class="form-control required"/>
					</td>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>开户行账号：</label></td>
					<td class="width-21" >
						<form:input path="bankNo" htmlEscape="false"  id="bankNo"  class="form-control required"/>
					</td>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>电话：</label></td>
					<td class="width-21" >
						<form:input path="tel" htmlEscape="false"  id="tel"  class="form-control required isTel"/>
					</td>
				</tr>
				<tr>
					<td class="width-12 active"><label class="pull-right"><font color="red">*</font>开户行地址：</label></td>
					<td class="width-21" >
						<form:input path="bankAddress" htmlEscape="false"  id="bankAddress"  class="form-control required"/>
					</td>
					<td class="width-12 active"><label class="pull-right">备注信息：</label></td>
					<td class="width-21" >
						<form:input path="remarks" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				</tbody>
			</table>
			<input type="hidden" id="ids" name="ids" value="${ids}"/>
			<input type="hidden" name="typeTarget" value="${target}" />
			<!-- 发票明细表 -->
			<ul class="nav nav-tabs nav-style">
				<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">结算单明细</a>
				</li>
			</ul>
			<!-- 表格 -->
			<div  class="tableBox">
				<table id="contentTable" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
					<thead>
					<tr>
						<th> <input type="checkbox" class="i-checks"></th>
						<th  class="sort-column clearingNo">结算单号</th>
						<th  class="sort-column clearingMoney">结算金额</th>
						<th  class="sort-column invoiceMoney">已开票金额</th>
						<th  class="sort-column invMoney">本次开票金额</th>
						<th  class="sort-column remarks">备注信息</th>
						<th>操作</th>
					</tr>
					</thead>
					<tbody id="detailTbody">
					<c:forEach items="${list}" var="feePayInvoiceDetail" varStatus="num">
						<c:if test="${flag eq 'payable'}">
							<input type="hidden" name="payee" id="payee" value="${feePayInvoiceDetail.payee.name}"/>
						</c:if>
						<tr  id="${feePayInvoiceDetail.id}">
							<td> <input type="checkbox" id="${feePayInvoiceDetail.id}" value="${feePayInvoiceDetail.id}" class="i-checks"></td>
							<td><!--different标记用在结算单form页面判断显示还是隐藏信息-->
								<c:if test="${flag eq 'invoice'}">
									<a  href="#" onclick="jp.openDialogView('查看应付结算单明细', '${ctx}/fee/payable/form?different=1&id=${feePayInvoiceDetail.feePayable.id}','900px', '500px')">
											${feePayInvoiceDetail.clearingNo}
									</a>
								</c:if>
								<c:if test="${flag eq 'payable'}">
									<a href="#" onclick="jp.openDialogView('查看应付结算单明细', '${ctx}/fee/payable/form?different=1&id=${feePayInvoiceDetail.id}','800px', '500px')">
											${feePayInvoiceDetail.clearingNo}
									</a>
								</c:if>
							</td>
							<td id="${feePayInvoiceDetail.id}_clearingMoney">
								<fmt:formatNumber value="${feePayInvoiceDetail.clearingMoney}" pattern="#.00"/>
							</td>
							<td id="${feePayInvoiceDetail.id}_voiceMoney">
								<c:if test="${feePayInvoiceDetail.invoiceMoney ne null and feePayInvoiceDetail.invoiceMoney > 0}">
									<fmt:formatNumber value="${feePayInvoiceDetail.invoiceMoney}" pattern="#.00"/>
								</c:if>
							</td>
							<td class="coun" name="${feePayInvoiceDetail.id}">
								<c:if test="${flag eq 'invoice'}">
									<input type="text" id="${feePayInvoiceDetail.id}_invMoney" disabled="disabled"
										   value="${feePayInvoiceDetail.invMoney}" class="form-control required" style="width:200px;"/>
								</c:if>
								<c:if test="${flag eq 'payable'}">
									<input type="text" id="${feePayInvoiceDetail.id}_invMoney"
										   onchange="inputBlur()" value="" class="form-control required" style="width:200px;"/>
								</c:if>
							</td>
							<td>
									${feePayInvoiceDetail.remarks}
							</td>
							<td>
								<c:if test="${flag eq 'invoice'}"><!--用于标记结算单页面隐藏某些功能-->
									<a href="#" onclick="jp.openDialogView('查看应付结算单明细', '${ctx}/fee/payable/form?different=1&id=${feePayInvoiceDetail.feePayable.id}','900px', '500px')" class="btn btn-info btn-xs" ><i class="fa fa-search-plus"></i> 查看</a>
								</c:if>
								<c:if test="${flag eq 'payable'}">
									<a href="#" onclick="jp.openDialogView('查看应付结算单明细', '${ctx}/fee/payable/form?different=1&id=${feePayInvoiceDetail.id}','800px', '500px')" class="btn btn-info btn-xs" ><i class="fa fa-search-plus"></i> 查看</a>
									<%--<input type="hidden" name="type" value="typePayable" />--%>
								</c:if>
								<c:if test="${payInvoice.id ne null and payInvoice.status eq 0}">
									<input type="button" onclick="deletes('${feePayInvoiceDetail.id}')" value="删除"  class="btn btn-danger btn-xs"><%--<i class="fa fa-trash"></i>删除--%>
								</c:if>
								<c:if test="${payInvoice.id eq null}">
									<input type="button" onclick="deleteInPage('${feePayInvoiceDetail.id}')" value="删除"  class="btn btn-danger btn-xs"/><%--<i class="fa fa-trash"></i>删除--%>
								</c:if>

							</td>
						</tr>
					</c:forEach>
					</tbody>
				</table>
			</div>
	<c:if test="${different ne 'paymentPage'}">
		<c:if test="${fns:hasPermission('fee:payInvoice:edit') || isAdd}">
				<div class="col-lg-3"></div>
		        <div class="col-lg-6">
		             <div class="form-group text-center">
		                 <div>
		                     <button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
		                 </div>
		             </div>
		        </div>
		</c:if>
	</c:if>
		</form:form>
		</div>				
	</div>
	</div>
</div>
</div>
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog" style="width: 750px">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<h4 class="modal-title" id="myModalLabel">应付结算单列表</h4>
				</div>
				<div class="modal-body">
					<!-- 查询条件 -->
					<div class="row">
						<div class="col-sm-12">
							<form action="" method="post" class="form-inline" id="searchForm">
								<div class="form-group pull-left">
									<span>结算方：</span>
									<input value="" type="text" name="balance" id="balance" title="" class="form-control input-sm"/>
								</div>
							</form>
							<div class="pull-right">
								<button  class="btn btn-primary btn-rounded btn-outline btn-sm " onclick="searchDetail()" ><i class="fa fa-search"></i> 查询</button>
								<button  class="btn btn-primary btn-rounded btn-outline btn-sm " onclick="reset()" ><i class="fa fa-refresh"></i> 重置</button>
							</div>
						</div>
					</div>
					<!-- 表格 -->
					<div  class="table-box1">
						<table id="content" class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable tableAjax">
							<thead>
							<tr>
								<th> <input type="checkbox" class="checkbox_css" id="allCheckBox" name="all"></th>
								<th  class="sort-column status">状态</th>
								<th  class="sort-column clearingNo">结算单号</th>
								<th  class="sort-column busyDate">结算日期</th>
								<th  class="sort-column payee">结算方</th>
								<th  class="sort-column clearingMoney">结算金额</th>
								<th  class="sort-column remarks">备注信息</th>
							</tr>
							</thead>
							<tbody id="payableLists">
							</tbody>
						</table>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary" onclick="detailSure()">确定</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>

				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal -->
	</div>
</body>
</html>